package xyz.chaobei.thread.blocked;

/**
 * @author <a href='mailto:maruichao52@gmail.com'>MRC</a>
 * @since 2021/1/29
 */
public class Main {

    public static void main(String[] args) {

        FileList list = new FileList();

        // 创建5个线程，随机获得3个文件
        for (int i = 0; i <= 5; i++) {
            Thread t = new FileGetter(list);
            t.start();
        }

    }

}

/**
 * 获取文件的内部类
 */
class FileGetter extends Thread {

    private FileList fileList;

    public FileGetter(FileList list) {
        this.fileList = list;
    }

    @Override
    public void run() {
        fileList.getFile();
    }
}
